﻿<UserControl
x:Class="AdventureWorksLT.Views.Customers.Controls.SalesOrderHeaderControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d"
x:Name="SalesOrderHeadersControlUI"
Background="AliceBlue"
xmlns:E2C="clr-namespace:AdventureWorksLT.Core"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:viewModels="clr-namespace:AdventureWorksLT.Views.Customers.ViewModels" 
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
xmlns:appControls="clr-namespace:AdventureWorksLT.Controls" 
>
<!--22 Fields --> 
<UserControl.Resources>
<viewModels:SalesOrderHeadersViewModel x:Key="SalesOrderHeadersViewModel" ></viewModels:SalesOrderHeadersViewModel>
 </UserControl.Resources>

 <appControls:BusyIndicator x:Name="BusyIndicator" BusyContent="Loading SalesOrderHeader data...." DataContext="{Binding Source={StaticResource SalesOrderHeadersViewModel}}" IsBusy="{Binding IsBusy}">
 <Grid x:Name="LayoutRoot"  DataContext="{Binding Source={StaticResource SalesOrderHeadersViewModel}}">
 <Border BorderBrush="#FF505050" BorderThickness="2" CornerRadius="3">
 <Border.Background>
 <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
 <GradientStop Color="#ED71A5D8" Offset="0.8" />
 <GradientStop Color="AliceBlue" Offset="1.09" />
 </LinearGradientBrush>
 </Border.Background>
 <ScrollViewer  VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" >
 <Grid HorizontalAlignment="Left" x:Name="SalesOrderHeaderGrid" VerticalAlignment="Top" >
<Grid.RowDefinitions>
<RowDefinition Height="32" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
 <ColumnDefinition Width="30" />
 <ColumnDefinition Width="Auto" />
 <ColumnDefinition Width="Auto" />
 <ColumnDefinition Width="60" />
 <ColumnDefinition Width="400*" />
</Grid.ColumnDefinitions>



<!-- uno -->
    <StackPanel Grid.Column="1" Grid.Row="1" Orientation="vertical"  >
<!-- dos -->
<TextBlock Height="30" ToolTipService.ToolTip="Sales Order Id" ToolTipService.Placement="Mouse" Text="Sales Order Id:"  HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Revision Number" ToolTipService.Placement="Mouse" Text="Revision Number:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="32" ToolTipService.ToolTip="Order Date" ToolTipService.Placement="Mouse" Text="Order Date:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="32" ToolTipService.ToolTip="Due Date" ToolTipService.Placement="Mouse" Text="Due Date:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="32" ToolTipService.ToolTip="Ship Date" ToolTipService.Placement="Mouse" Text="Ship Date:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Status" ToolTipService.Placement="Mouse" Text="Status:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Online Order Flag" ToolTipService.Placement="Mouse" Text="Online Order Flag:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Sales Order Number" ToolTipService.Placement="Mouse" Text="Sales Order Number:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Purchase Order Number" ToolTipService.Placement="Mouse" Text="Purchase Order Number:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Account Number" ToolTipService.Placement="Mouse" Text="Account Number:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Customer Id" ToolTipService.Placement="Mouse" Text="Customer Id:"  HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />

<TextBlock Height="30" ToolTipService.ToolTip="Ship To Address Id" ToolTipService.Placement="Mouse" Text="Ship To Address Id:"  HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Bill To Address Id" ToolTipService.Placement="Mouse" Text="Bill To Address Id:"  HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Ship Method" ToolTipService.Placement="Mouse" Text="Ship Method:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Credit Card Approval Code" ToolTipService.Placement="Mouse" Text="Credit Card Approval Code:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Sub Total" ToolTipService.Placement="Mouse" Text="Sub Total:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Tax Amt" ToolTipService.Placement="Mouse" Text="Tax Amt:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Freight" ToolTipService.Placement="Mouse" Text="Freight:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Total Due" ToolTipService.Placement="Mouse" Text="Total Due:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Comment" ToolTipService.Placement="Mouse" Text="Comment:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="30" ToolTipService.ToolTip="Rowguid" ToolTipService.Placement="Mouse" Text="Rowguid:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />
<TextBlock Height="32" ToolTipService.ToolTip="Modified Date" ToolTipService.Placement="Mouse" Text="Modified Date:"   HorizontalAlignment="Left" Margin="1" VerticalAlignment="Center" Foreground="#FF7635FC"  Width="180" TextWrapping="Wrap" FontFamily="Verdana" FontSize="10.667" TextTrimming="None" />

</StackPanel>
<StackPanel Grid.Column="2" Grid.Row="1" Orientation="vertical"  >
<!-- tres -->
<TextBlock  Height="30" HorizontalAlignment="Left" Margin="1" Text="{Binding CurrentSalesOrderHeaders.SalesOrderID, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" FontWeight="Bold" />
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Revision Number" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.RevisionNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<sdk:DatePicker Style="{StaticResource JetPackDatePicker}" ToolTipService.ToolTip="Order Date" ToolTipService.Placement="Mouse"  Height="30" HorizontalAlignment="Left" Margin="1"  SelectedDate="{Binding CurrentSalesOrderHeaders.OrderDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<sdk:DatePicker Style="{StaticResource JetPackDatePicker}" ToolTipService.ToolTip="Due Date" ToolTipService.Placement="Mouse"  Height="30" HorizontalAlignment="Left" Margin="1"  SelectedDate="{Binding CurrentSalesOrderHeaders.DueDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<sdk:DatePicker Style="{StaticResource JetPackDatePicker}" ToolTipService.ToolTip="Ship Date" ToolTipService.Placement="Mouse"  Height="30" HorizontalAlignment="Left" Margin="1"  SelectedDate="{Binding CurrentSalesOrderHeaders.ShipDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Status" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.Status, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<CheckBox ToolTipService.ToolTip="Online Order Flag" ToolTipService.Placement="Mouse" Content=""  Height="16" HorizontalAlignment="Left" Margin="8"  IsChecked="{Binding CurrentSalesOrderHeaders.OnlineOrderFlag, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="70" FontSize="15" HorizontalContentAlignment="Left" />
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Sales Order Number" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.SalesOrderNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left"  MaxLength="25"/>
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Purchase Order Number" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.PurchaseOrderNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left"  MaxLength="25"/>
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Account Number" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.AccountNumber, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left"  MaxLength="15"/>

<ComboBox  ItemsSource="{Binding CustomerCollection, Mode=TwoWay}" DisplayMemberPath = "FirstName" SelectedItem="{Binding SelectedCustomer, Mode=TwoWay}" x:Name="CustomerIDComboBox"  VerticalAlignment="Top" Width="180" FontSize="15" Background="#FFFCF6EA" Height="30" Foreground="Black" Margin="1">
<ComboBox.BorderBrush>
<SolidColorBrush Color="#FF0E1601"/>
</ComboBox.BorderBrush>
</ComboBox>


<ComboBox  ItemsSource="{Binding ShipToAddressCollection, Mode=TwoWay}" DisplayMemberPath = "AddressLine1" SelectedItem="{Binding SelectedShipToAddress, Mode=TwoWay}" x:Name="ShipToAddressIDComboBox"  VerticalAlignment="Top" Width="180" FontSize="15" Background="#FFFCF6EA" Height="30" Foreground="Black" Margin="1">
<ComboBox.BorderBrush>
<SolidColorBrush Color="#FF0E1601"/>
</ComboBox.BorderBrush>
</ComboBox>

<ComboBox  ItemsSource="{Binding BillToAddressCollection, Mode=TwoWay}" DisplayMemberPath = "AddressLine1" SelectedItem="{Binding SelectedBillToAddress, Mode=TwoWay}" x:Name="BillToAddressIDComboBox"  VerticalAlignment="Top" Width="180" FontSize="15" Background="#FFFCF6EA" Height="30" Foreground="Black" Margin="1">
<ComboBox.BorderBrush>
<SolidColorBrush Color="#FF0E1601"/>
</ComboBox.BorderBrush>
</ComboBox>
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Ship Method" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.ShipMethod, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left"  MaxLength="50"/>
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Credit Card Approval Code" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.CreditCardApprovalCode, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left"  MaxLength="15"/>
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Sub Total" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.SubTotal, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Tax Amt" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.TaxAmt, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Freight" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.Freight, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Total Due" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.TotalDue, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Comment" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.Comment, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left"  MaxLength="1000"/>
<TextBox Style="{StaticResource JetPackTextBox}" ToolTipService.ToolTip="Rowguid" ToolTipService.Placement="Mouse" Height="30" HorizontalAlignment="Left" Margin="1"  Text="{Binding CurrentSalesOrderHeaders.rowguid, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />
<sdk:DatePicker Style="{StaticResource JetPackDatePicker}" ToolTipService.ToolTip="Modified Date" ToolTipService.Placement="Mouse"  Height="30" HorizontalAlignment="Left" Margin="1"  SelectedDate="{Binding CurrentSalesOrderHeaders.ModifiedDate, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true, TargetNullValue=''}" VerticalAlignment="Center" Width="180" FontSize="15" HorizontalContentAlignment="Left" />

</StackPanel>



                        <StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal"  Grid.ColumnSpan="5">
                            <Button   x:Name="printButton" Content="Imprimir" Margin="0,10,5,5" Width="100"  Height="30" HorizontalAlignment="Left" Command="{Binding PrintSalesOrderHeadersCommand}"  />
                            <Button  x:Name="addButton" Content="Agregar Nueva" Margin="5,10,5,5" Width="100"  Height="30" HorizontalAlignment="Left" Command="{Binding AddNewSalesOrderHeadersCommand}" />
                            <Button   x:Name="saveButton" Content="Save" Margin="5,10,5,5"  Width="100"  Height="30" HorizontalAlignment="Left" Command="{Binding SaveSalesOrderHeadersCommand}"  />
                            <Button   x:Name="deleteButton" Content="Eliminar" Margin="5,10,5,5" Width="100"  Height="30" HorizontalAlignment="Left" Command="{Binding DeleteSalesOrderHeadersCommand}" />
                        </StackPanel>
                        
<StackPanel Grid.Column="4" Grid.Row="1" Orientation="vertical"  >
<!-- cuatro -->
<!--<Controls:RadDataPager telerik1:StyleManager.Theme="Windows7" Height="33" x:Name="SalesOrderHeadersDataPager" PageSize="5" Margin="1,-5,1,1"  Source="{Binding Items, ElementName=SalesOrderHeadersDataGrid}" DisplayMode="FirstLastPreviousNext" AutoEllipsisMode="Both" NumericButtonCount="0" IsTotalItemCountFixed="True" Style="{StaticResource RadDataPagerStyle1}"/>-->

    
</StackPanel>
    <!-- 2 -->
                    </Grid>
                </ScrollViewer>
            </Border>
        </Grid>
    </appControls:BusyIndicator>
</UserControl>
<!--
SalesOrderDetail

Now Parent Rels 

Customer
Address
Address

5
-->
